package com.woniuxy.springbootpro.mapper;


import com.woniuxy.springbootpro.entity.Root;
import com.woniuxy.springbootpro.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper{

    @Select("select * from user where uid=#{uid}")
    User findById(Integer id);

    @Select("select * from user")
    List<User> findAll();

    @Insert("insert into user (uid,account,password,name) values (#{uid},#{account},#{password},#{name})")
    int add(User user);

    @Delete("delete from user where uid=#{uid}")
    int delete(Integer id);

    int update(User user);

    User findUserByNameAndPwd(User user);

    List<Root> findUserRootById(@Param("userId") int userId);
}
